import App from './App'
	const httpRequest = require("@/common/httpRequest.js")
  // 秒转分秒
  const formatSeconds = (value = 0) => {
    let result = parseInt(value);
    let m = Math.floor((result / 60) % 60) < 10 ? '0' + Math.floor((result / 60) % 60) : Math.floor((result / 60) % 60);
    let s = Math.floor(result % 60) < 10 ? '0' + Math.floor(result % 60) : Math.floor(result % 60);
    return `${m}:${s}`;
  };
  const lbtpriview = (index, arr) => { //预览图片
  	var i = arr; //获取当前页面的轮播图数据
  	//uniapp预览轮播图
  	uni.previewImage({
  		current: index, //预览图片的下标
  		urls: i //预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
  	})
  }
  const copy = (value) => { //复制
  	uni.setClipboardData({
  		data: value, //要被复制的内容
  		success: () => {
  			//复制成功的回调函数
  			httpRequest.toast("复制成功")
  		}
  	});
  }
  const callphone = (p) => {
  	uni.makePhoneCall({
  		phoneNumber: p.toString()
  	}).catch((e) => {
  		// console.log(e)  //用catch(e)来捕获错误{makePhoneCall:fail cancel}
  	})
  }
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
Vue.prototype.copy = copy
Vue.prototype.formatSeconds = formatSeconds
Vue.prototype.callphone = callphone
Vue.prototype.lbtpriview = lbtpriview
App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif
// main.js
import uView from "uview-ui";
Vue.use(uView);